package com.kye.express.business.deposit_recharge.online;

import android.databinding.DataBindingUtil;
import android.os.Bundle;

import com.kye.base.Logger;
import com.kye.express.R;
import com.kye.express.business.base.BaseToolbarActivity;
import com.kye.express.databinding.ActivityRechargeOnlineSuccessBinding;
import com.kye.express.utils.IntentUtil;
import com.kye.express.utils.StringUtils;
import com.kye.model.constant.Constants;

import java.text.NumberFormat;
import java.util.Currency;
import java.util.Locale;

/**
 * 预存运费-充值(线上)-充值成功 Activity
 * <p>
 * Created by SkyYu on 2018/1/18
 */
public class RechargeOnlineSuccessActivity extends BaseToolbarActivity {

    protected ActivityRechargeOnlineSuccessBinding mBinding;

    public static void startActivity(String money, String time, String mode, String account) {
        String[] key = {Constants.KEY_PAYMONEY, Constants.KEY_PAYTIME, Constants.KEY_PAYMODE, Constants.KEY_PAYACCOUNT};
        String[] value = {money, time, mode, account};
        IntentUtil.showIntent(RechargeOnlineSuccessActivity.class, key, value);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initViews();
        initData();
    }

    private void initViews() {
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_recharge_online_success);

        setUpToolbar(mBinding.toolbarRechargeOnlineSuccess);
        setTitle("");
    }

    private void initData() {
        String payMoney = getIntent().getStringExtra(Constants.KEY_PAYMONEY);
        String payTime = getIntent().getStringExtra(Constants.KEY_PAYTIME);
        String payMode = getIntent().getStringExtra(Constants.KEY_PAYMODE);
        String payAccount = getIntent().getStringExtra(Constants.KEY_PAYACCOUNT);
        mBinding.setData(new RechargeOnlineImagesModel(payMoney, payTime, payMode, payAccount));
        mBinding.textviewRechargeOnlineSuccessNum.setText(StringUtils.getMoneyFormatChina(Double.parseDouble(payMoney))); // 货币需要格式化所以额外单独处理
    }
}